calculate the speed of the ball